<?php
namespace Admin\Controller;
use Think\Controller;
class IndexController extends Controller {
    public function index(){
     $this->display();
    }

     public function count()
    {
        $this->count1 = M('users')->count();
        $this->count2 = M('food')->count();
        $this->count3 = M('type')->count();
        $this->count4 = M('comments')->count();
        $this->display();
     }


    public function checkLogin(){
      
        $admin=M('admins');
        $map = array();
        $map['username']  = I('post.username');
        $map['password']    = I('post.password');
       
        $res=$admin->where($map)->select();
 
        if($res==null){
            $this->error('用户名密码错误');
        }else {
            session("flag","logok");
            redirect('count');
        }
    }

    public function verify(){
        ob_clean();
        $Verify = new \Think\Verify();
        $Verify->entry();
    }
       public function logout(){
      
    
         session(null);
         
            $this->success('退出成功！', U('Index/index'));
        
    } 
    
}